package 多线程.多线程;

public class ThreadState {
    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000_0000; i++) {

                }
            }
        },"子线程");
        System.out.println(t1.getName() + " :" + t1.getState());
        t1.start();
        System.out.println(t1.getName() + " :" + t1.getState());
        while (t1.isAlive()){
            System.out.println(t1.getName() + " :" + t1.getState());

//        t1.wait();
//        System.out.println(t1.getName() + " :" + t1.getState());
        t1.join(1000);
        System.out.println(t1.getName() + " :" + t1.getState());
        t1.interrupt();
        System.out.println(t1.getName() + " :" + t1.getState());
        }
    }
}
